package de.tabuma.sso.usergroup;

import de.tabuma.sso.usergroup.*;
import de.tabuma.sso.logik.*;
import java.util.*;

/**
 * @author $Author: alefen $
 * @version $Revision: 1.1.1.1.2.1 $
 * @since $Date: 2010/01/08 10:03:24 $
 */
public class UserGroupFacade implements de.tabuma.lib.contentmanagement.FacadeInterface {
    public static int create(UserGroup usergroup, String user) {
        return (int) PMF.doCreate(usergroup, user);
    }

    public int createElement(Object object, String user) {
        return create((UserGroup) object,user);
    }

    public static void update(UserGroup usergroup, String user) {
        PMF.doUpdate(usergroup, user);
    }

    public void updateElement(Object object, String user) {
        update((UserGroup)object,user);
    }

    public static UserGroup get(int id) {
        return PMF.get(id, new UserGroup());
    }

    public Object getElement(int id) {
        return get(id);
    }

    public static void remove(int id, String user) {
        UserGroup usergroup = get(id);
        PMF.doRemove(usergroup, user);
    }

    public void removeElement(int id, String user) {
        remove(id,user);
    }
    
    public static List<UserGroup> getList(int groupId) {
        String keys[] = new String[1];
        keys[0] = "groupId";
        String values[] = new String[1];
        values[0] = "" + groupId;
        return PMF.get(keys, values, new UserGroup());
    }

    public static List<UserGroup> getList1(int userId) {
        String keys[] = new String[1];
        keys[0] = "userId";
        String values[] = new String[1];
        values[0] = "" + userId;
        return PMF.get(keys, values, new UserGroup());
    }

    public List getElementList(String listParameter) {
        int id = Integer.valueOf(listParameter).intValue();
        return getList(id);
    }


}
